/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HCI_ERROR_H
#define HCI_ERROR_H

#ifdef __cplusplus
extern "C" {
#endif

// BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part D
// 1.3 LIST OF ERROR CODES

#define HCI_SUCCESS 0x00
#define HCI_UNKNOWN_HCI_COMMAND 0x01
#define HCI_UNKNOWN_CONNECTION_IDENTIFIER 0x02
#define HCI_HARDWARE_FAILURE 0x03
#define HCI_PAGE_TIMEOUT 0x04
#define HCI_AUTHENTICATION_FAILURE 0x05
#define HCI_PIN_OR_KEY_MISSING 0x06
#define HCI_MEMORY_CAPACITY_EXCEEDED 0x07
#define HCI_CONNECTION_TIMEOUT 0x08
#define HCI_CONNECTION_LIMIT_EXCEEDED 0x09
#define HCI_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A
#define HCI_CONNECTION_ALREADY_EXISTS 0x0B
#define HCI_COMMAND_DISALLOWED 0x0C
#define HCI_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D
#define HCI_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0E
#define HCI_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR 0x0F
#define HCI_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x10
#define HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11
#define HCI_INVALID_HCI_COMMAND_PARAMETERS 0x12
#define HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13
#define HCI_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14
#define HCI_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF 0x15
#define HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST 0x16
#define HCI_REPEATED_ATTEMPTS 0x17
#define HCI_PAIRING_NOT_ALLOWED 0x18
#define HCI_UNKNOWN_LMP_PDU 0x19
#define HCI_UNSUPPORTED_REMOTE_FEATURE_OR_UNSUPPORTED_LMP_FEATURE 0x1A
#define HCI_SCO_OFFSET_REJECTED 0x1B
#define HCI_SCO_INTERVAL_REJECTED 0x1C
#define HCI_SCO_AIR_MODE_REJECTED 0x1D
#define HCI_INVALID_LMP_PARAMETERS_OR_INVALID_LL_PARAMETERS 0x1E
#define HCI_UNSPECIFIED_ERROR 0x1F
#define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE_OR_UNSUPPORTED_LL_PARAMETER_VALUE 0x20
#define HCI_ROLE_CHANGE_NOT_ALLOWED 0x21
#define HCI_LMP_RESPONSE_TIMEOUT_OR_LL_RESPONSE_TIMEOUT 0x22
#define HCI_LMP_ERROR_TRANSACTION_COLLISION_OR_LL_PROCEDURE_COLLISION 0x23
#define HCI_LMP_PDU_NOT_ALLOWED 0x24
#define HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25
#define HCI_LINK_KEY_CANNOT_BE_CHANGED 0x26
#define HCI_REQUESTED_QOS_NOT_SUPPORTED 0x27
#define HCI_INSTANT_PASSED 0x28
#define HCI_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29
#define HCI_DIFFERENT_TRANSACTION_COLLISION 0x2A
#define HCI_QOS_UNACCEPTABLE_PARAMETER 0x2C
#define HCI_QOS_REJECTED 0x2D
#define HCI_CHANNEL_CLASSIFICATION_NOT_SUPPORTED 0x2E
#define HCI_INSUFFICIENT_SECURITY 0x2F
#define HCI_PARAMETER_OUT_OF_MANDATORY_RANGE 0x30
#define HCI_ROLE_SWITCH_PENDING 0x32
#define HCI_RESERVED_SLOT_VIOLATION 0x34
#define HCI_ROLE_SWITCH_FAILED 0x35
#define HCI_EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 0x36
#define HCI_SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37
#define HCI_HOST_BUSY_PAIRING 0x38
#define HCI_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND 0x39
#define HCI_CONTROLLER_BUSY 0x3A
#define HCI_UNACCEPTABLE_CONNECTION_PARAMETERS 0x3B
#define HCI_ADVERTISING_TIMEOUT 0x3C
#define HCI_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D
#define HCI_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E
#define HCI_MAC_CONNECTION_FAILED 0x3F
#define HCI_COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40
#define HCI_TYPE0_SUBMAP_NOT_DEFINED 0x41
#define HCI_UNKNOWN_ADVERTISING_IDENTIFIER 0x42
#define HCI_LIMIT_REACHED 0x43
#define HCI_OPERATION_CANCELLED_BY_HOST 0x44

// Stack definition
#define HCI_TIMEOUT 0xE1

#ifdef __cplusplus
}
#endif

#endif